﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.IO;
using System.IO.Compression;
namespace zCO
{
    public class GZip
    {
        public static void Compress(string fileToCompress, string compressedFile)
        {
            using (FileStream source = File.OpenRead(fileToCompress))
            {
                using (FileStream dest = File.Create(compressedFile))
                {
                    using (GZipStream gzip = new GZipStream(dest, CompressionMode.Compress))
                    {
                        Byte[] data = new byte[source.Length];
                        source.Read(data, 0, data.Length);
                        gzip.Write(data, 0, data.Length);
                    }
                }
            }
        }
    }
}